<template>
  <div>
    <input type="text" v-model="task" @keyup.enter="addTask()" />
    <button @click="addTask()">添加</button>
  </div>
</template>

<script>
export default {
  name: "DataAdder",
  data() {
    return {
      task: "",
    };
  },
  methods: {
    addTask() {
      // 告诉父组件 用户想添加aaa 具体怎么添加由父组件自行决定
      this.$emit("addTask", this.task);
      this.task = "";
    },
  },
  props: {},
};
</script>
